package com.example.yls.inote.db;

import android.provider.BaseColumns;

import static android.provider.BaseColumns._ID;
import static com.example.yls.inote.db.NotesContract.NoteTable.BODY;
import static com.example.yls.inote.db.NotesContract.NoteTable.CREATED_AT;
import static com.example.yls.inote.db.NotesContract.NoteTable.IS_PINNED;
import static com.example.yls.inote.db.NotesContract.NoteTable.TITLE;
import static com.example.yls.inote.db.NotesContract.NoteTable.UPDATED_AT;
import static com.example.yls.inote.db.NotesContract.NoteTable._TABLE_NAME;

public final class NotesContract {
    private NotesContract() {}

    public static final String SQL_CREATE_ENTRIES =
            "CREATE TABLE " + _TABLE_NAME + " (" +
            _ID + " INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
            TITLE + " TEXT, " +
            BODY +" TEXT, "+
            IS_PINNED + " INTEGER, " +
            CREATED_AT + " INTEGER, " +
            UPDATED_AT + " INTEGER" +
            ")";

    public static final String SQL_DELETE_ENTRIES =
            "DROP TABLE IF EXISTS " + _TABLE_NAME;

    public static final String SQL_QUERY_ALL =
            "SELECT * FROM NOTE ORDER BY " + CREATED_AT + " DESC";

    public interface NoteTable extends BaseColumns {
        String _TABLE_NAME = "notes";
        String TITLE = "title";
        String BODY = "body";
        String IS_PINNED = "is_pinned";
        String CREATED_AT = "created_at";
        String UPDATED_AT = "updated_at";
    }
}
